package com.vogue.supplymall.payment.dto;

import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 订单支付状态查询结果主体信息封装对象
 * 
 * @author 崔岳
 *
 */
public class PayQueryResultData extends BaseDTO implements Serializable{

	private static final long serialVersionUID = 4127179303218984573L;

    public static final Logger LOGGER_PAYQUERYRESULTDATA = LoggerFactory.getLogger(PayQueryResultData.class);
    
	/** 买家支付账户 */
	
	private String attach;
	
	/** 商家优惠 */
	private String mdiscount;
	
	/**
	 * 是查询结果状态码，0 表明成功，其他表明错误
	 */
	private Integer ret_code;
	
	/**
	 * 查询结果出错信息
	 */
	private String ret_msg;
	
	/**
	 * 支付时间
	 */
	private String time_end;
	
	/**
	 * 订单总金额
	 */
	private Double total_money;
	
	/**
	 * 订单状态，0 为已支付，1待支付，2撤销
	 */
	private String trade_state;
	
	/**
	 * 第三方平台支付ID
	 */
	private String transaction_id;
	
	/**
	 * 支付订单明细(具体字段说明见接口：拉取线上支付订单字段说明)
	 */
	private PayQueryResultDataPayorderInfo payorderInfo;

	public String getAttach() {
		return attach;
	}

	public void setAttach(String attach) {
		this.attach = attach;
	}

	public String getMdiscount() {
		return mdiscount;
	}

	public void setMdiscount(String mdiscount) {
		this.mdiscount = mdiscount;
	}

	public Integer getRet_code() {
		return ret_code;
	}

	public void setRet_code(Integer ret_code) {
		this.ret_code = ret_code;
	}

	public String getRet_msg() {
		return ret_msg;
	}

	public void setRet_msg(String ret_msg) {
		this.ret_msg = ret_msg;
	}

	public String getTime_end() {
		return time_end;
	}

	public void setTime_end(String time_end) {
		this.time_end = time_end;
	}

	public Double getTotal_money() {
		return total_money;
	}

	public void setTotal_money(Double total_money) {
		this.total_money = total_money;
	}

	public String getTrade_state() {
		return trade_state;
	}

	public void setTrade_state(String trade_state) {
		this.trade_state = trade_state;
	}

	public String getTransaction_id() {
		return transaction_id;
	}

	public void setTransaction_id(String transaction_id) {
		this.transaction_id = transaction_id;
	}

	public PayQueryResultDataPayorderInfo getPayorderInfo() {
		return payorderInfo;
	}

//	public void setPayorderInfo(PayQueryResultDataPayorderInfo payorderInfo) {
//		this.payorderInfo = payorderInfo;
//	}
	
	public void setPayorderInfo(Map<String, ? extends Object> payorderInfo) {
	    try {
	        PayQueryResultDataPayorderInfo obj = PayQueryResultDataPayorderInfo.class.newInstance();
            org.apache.commons.beanutils.BeanUtils.populate(obj, (Map<String, ? extends Object>) payorderInfo);
            this.payorderInfo = obj;
        } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
            LOGGER_PAYQUERYRESULTDATA.error("支付订单明细对象转化异常：{}", e.getMessage());
        } 
    }
}
